local Class = require('lua.lang.Class')
local TokenKind = require('lua.parser.TokenKind')

--- @class LexToken : Class
--- @field kind TokenKind
--- @field line number
--- @field column number
--- @field value string
local LexToken = Class {}

--- @param kind TokenKind
--- @param line number
--- @param column number
--- @param value string
--- @return LexToken
function LexToken:new(kind, line, column, value)
	--- @type LexToken
	local o = {}
	o.kind = kind
	o.line = line
	o.column = column
	o.value = value
	return setmetatable(o, LexToken)
end

--- @return string
function LexToken:getName()
	return self.kind.name
end

--- @return string
function LexToken:toString()
	return string.format('%s(%s)', self:getName(), self.value)
end

--- @return boolean
function LexToken:isEof()
	return self.kind == TokenKind.Eof
end

return LexToken